package com.ruoyi.carService.service.impl;

import java.util.List;

import com.ruoyi.system.api.domain.ReleaseInformation;
import com.ruoyi.carService.mapper.ReleaseInformationMapper;
import com.ruoyi.system.api.domain.CheckInformation;
import com.ruoyi.system.api.domain.ReleaseInformation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.carService.mapper.CheckInformationMapper;
import com.ruoyi.system.api.domain.CheckInformation;
import com.ruoyi.carService.service.ICheckInformationService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 审核Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-09-09
 */
@Service
@Transactional
public class CheckInformationServiceImpl implements ICheckInformationService 
{
    @Autowired
    private CheckInformationMapper checkInformationMapper;
    @Autowired
    private ReleaseInformationMapper releaseInformationMapper;

    /**
     * 查询审核
     * 
     * @param ciId 审核主键
     * @return 审核
     */
    @Override
    public CheckInformation selectCheckInformationByCiId(Long ciId)
    {
        return checkInformationMapper.selectCheckInformationByCiId(ciId);
    }

    /**
     * 查询审核列表
     * 
     * @param checkInformation 审核
     * @return 审核
     */
    @Override
    public List<CheckInformation> selectCheckInformationList(CheckInformation checkInformation)
    {
        return checkInformationMapper.selectCheckInformationList(checkInformation);
    }

    /**
     * 新增审核 的同时修改信息发布表对应的审核状态
     * 
     * @param checkInformation 审核
     * @return 结果
     */
    @Override
    public int insertCheckInformation(CheckInformation checkInformation)
    {
        ReleaseInformation releaseInformation = new ReleaseInformation();
        releaseInformation.setRiId(checkInformation.getRiId());
        releaseInformation.setRiReviewStatus(checkInformation.getCiResult());
        releaseInformationMapper.updateReleaseInformation(releaseInformation);
        return checkInformationMapper.insertCheckInformation(checkInformation);
    }

    /**
     * 修改审核
     * 
     * @param checkInformation 审核
     * @return 结果
     */
    @Override
    public int updateCheckInformation(CheckInformation checkInformation)
    {
        return checkInformationMapper.updateCheckInformation(checkInformation);
    }

    /**
     * 批量删除审核
     * 
     * @param ciIds 需要删除的审核主键
     * @return 结果
     */
    @Override
    public int deleteCheckInformationByCiIds(Long[] ciIds)
    {
        return checkInformationMapper.deleteCheckInformationByCiIds(ciIds);
    }

    /**
     * 删除审核信息
     * 
     * @param ciId 审核主键
     * @return 结果
     */
    @Override
    public int deleteCheckInformationByCiId(Long ciId)
    {
        return checkInformationMapper.deleteCheckInformationByCiId(ciId);
    }

    @Override
    public CheckInformation selectCheckInformationById(Long riId) {
        return checkInformationMapper.selectCheckInformationById(riId);
    }
}
